package cn.cas.mango.Db;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;

import java.util.HashSet;
import java.util.Set;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class KeywordsCast {
  @Id
  private String id;
  private Set<Keywords2IdDate> document;
  public KeywordsCast(String keyword, Keywords2IdDate keywords2IdDate) {
    this(keyword, new HashSet<Keywords2IdDate>(){{add(keywords2IdDate);}});
  }

  public void add(Keywords2IdDate keywords2IdDate) {
    if (document == null) {
      document = new HashSet<>();
    }
    document.add(keywords2IdDate);
  }
}
